fd6f3e1e9c1b2e193c797055d1d5ae34706d562a,integrations/opennms-rancid/src/main/java/org/opennms/netmgt/provision/RancidProvisioningAdapter.java,RancidProvisioningAdapter,getSuitableIpForRancid,#OnmsNode#,386
Before Change
private String getSuitableIpForRancid(OnmsNode node){
OnmsIpInterface primaryInterface = node.getPrimaryInterface();
if (primaryInterface == null) {
Set<OnmsIpInterface> ipInterfaces = node.getIpInterfaces();
for (OnmsIpInterface onmsIpInterface : ipInterfaces) {
return onmsIpInterface.getIpAddress();
}
}
return primaryInterface.getIpAddress();
}
private String getSuitableIpForRancid(Integer nodeId) {
After Change
private String getSuitableIpForRancid(OnmsNode node){
log().debug("getSuitableIpForRancid: node: " + node.getNodeId() + " Foreign Source: " + node.getForeignSource());
OnmsIpInterface primaryInterface = node.getPrimaryInterface();
String ipaddr = "127.0.0.1";
if (primaryInterface == null) {
log().debug("getSuitableIpForRancid: found null Snmp Primary Interface, getting interfaces");
Set<OnmsIpInterface> ipInterfaces = node.getIpInterfaces();
for (OnmsIpInterface onmsIpInterface : ipInterfaces) {
log().debug("getSuitableIpForRancid: trying Interface with id: " + onmsIpInterface.getId());
if (onmsIpInterface.getIpAddress() != null)
ipaddr = onmsIpInterface.getIpAddress();
else
log().debug("getSuitableIpForRancid: found null ip address on Interface with id: " + onmsIpInterface.getId());
}
} else {
log().debug("getSuitableIpForRancid: found Snmp Primary Interface");
if (primaryInterface.getIpAddress() != null )
ipaddr = primaryInterface.getIpAddress();
else
log().debug("getSuitableIpForRancid: found null ip address on Primary Interface");
}
return ipaddr;
}
private String getSuitableIpForRancid(Integer nodeId) {